package com.cheng.example.atguigu.design_pattern.command;

/*
 * @author 程帅
 * @createTime: 2020/10/19 8:34
 * @Created: with IntelliJ IDEA.
 */

public class LightOnCommand implements Command {

    LightReceiver light;

    //构造器
    public LightOnCommand(LightReceiver light) {
        super();
        this.light = light;
    }

    @Override
    public void execute() {
        //调用接收者的方法
        light.on();
    }

    @Override
    public void undo() {
        //调用接收者的方法
        light.off();
    }

}
